package com.cays.myresearch.action;

import android.app.ProgressDialog;
import android.content.Context;

import com.cays.myresearch.constant.Constant;

/**
 * Created by cays on 2018/12/12.
 */

public class DialogAction {
    private ProgressDialog dialog;
    private Context context;
    public DialogAction(Context context,String msg){
        this.context=context;
        this.dialog=getProgressDialog(context,msg);
    }
    public void show(){
        if (dialog!=null&&!dialog.isShowing()){
            dialog.show();
        }
    }
    public void dismiss(){
        if (dialog!=null&&dialog.isShowing()){
            dialog.dismiss();
        }
    }
    public ProgressDialog getProgressDialog(Context context,String msg) {
        ProgressDialog progressDialog = new ProgressDialog(context);
        progressDialog.setIndeterminate(true);
        progressDialog.setMessage(msg);
        progressDialog.setCancelable(true);
        return progressDialog;

    }
}
